package com.szit.test.servlet;

import com.szit.test.biz.SaleBiz;
import com.szit.test.biz.impl.SaleBizImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "DeleteServlet",value = "/sys/delete")
public class DeleteSaleServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");

        String sid = request.getParameter("id");

        if(sid != null && sid != ""){
            int id = Integer.parseInt(sid);

            // 调用逻辑层
            SaleBiz tbiz = new SaleBizImpl();
            int flag = tbiz.delete(id);
        }

        // 跳转到列表页面
        response.sendRedirect("listteacher.jsp");
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }
}
